package com.yunbao.project.basedata.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yunbao.project.basedata.entity.Goods;
import com.yunbao.project.basedata.mapper.GoodsMapper;
import com.yunbao.project.basedata.query.GoodsQuery;
import com.yunbao.project.basedata.service.IGoodsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 * 商品 服务实现类
 * </p>
 *
 * @author 安能
 * @since 2019-09-16
 */
@Service
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements IGoodsService {


    @Resource
    GoodsMapper goodsMapper;


    @Override
    public IPage<Goods> getListLike(GoodsQuery goodsQuery) {

        return goodsMapper.selectPage(new Page<>(goodsQuery.getCurrent(), goodsQuery.getSize()),
                        new QueryWrapper<Goods>()
                                .like("serial_number", goodsQuery.getSerialNumber())
                );

    }
}
